# apps/monitoring/urls.py

from django.urls import path
from .views import (
    SensorReadingList, CollectReading,
    ActionLogList, UnifiedMessageList,
    MessagePageView, latest_sensor_readings
)

urlpatterns = [
    # ---------- 页面 ----------
    # /messages/  -> 渲染 templates/messages.html
    path('messages/',         MessagePageView.as_view(),     name='msg-page'),

    # ---------- API ----------
    path('messages/api/',     UnifiedMessageList.as_view(),  name='msg-api'),
    path('sensor_readings/',          SensorReadingList.as_view()),
    path('sensor_readings/collect/',  CollectReading.as_view()),
    path('action_logs/',              ActionLogList.as_view()),
    path('sensor_readings/latest/', latest_sensor_readings, name='latest-sensor-readings'),
]
